<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
         <link href="${pageContext.request.contextPath}/adminfile/assets/css/bootstrap.min.css" rel="stylesheet" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/adminfile/css/style.css"/>       
        <link href="${pageContext.request.contextPath}/adminfile/assets/css/codemirror.css" rel="stylesheet">
        <link rel="stylesheet" href="${pageContext.request.contextPath}/adminfile/assets/css/ace.min.css" />
        <link rel="stylesheet" href="${pageContext.request.contextPath}/adminfile/font/css/font-awesome.min.css" />
        <!--[if lte IE 8]>
		  <link rel="stylesheet" href="assets/css/ace-ie.min.css" />
		<![endif]-->
		<script src="${pageContext.request.contextPath}/adminfile/js/jquery-1.9.1.min.js"></script>
		<script src="${pageContext.request.contextPath}/adminfile/assets/js/typeahead-bs2.min.js"></script>   
        <script src="${pageContext.request.contextPath}/adminfile/js/lrtk.js" type="text/javascript" ></script>		
		<script src="${pageContext.request.contextPath}/adminfile/assets/js/jquery.dataTables.min.js"></script>
		<script src="${pageContext.request.contextPath}/adminfile/assets/js/jquery.dataTables.bootstrap.js"></script>
        <script src="${pageContext.request.contextPath}/adminfile/assets/layer/layer.js" type="text/javascript" ></script>                 
		
<title>艺术品信息管理</title>
</head>

<body>
<div class="page-content clearfix">
 <div class="sort_style">
     <div class="border clearfix">
       <span class="l_f">
        <a href="javascript:ovid()" class="btn btn-danger"><i class="fa fa-trash"></i> 批量删除</a>
       </span>
       <span class="r_f">共：<b>${auctionInfoList.size()}</b>条</span>
     </div>
  <div class="sort_list">
    <table class="table table-striped table-bordered table-hover" id="sample-table">
		<thead>
		  <tr>
				<th width="25"><label><input type="checkbox" class="ace"><span class="lbl"></span></label></th>
				<th width="50">ID</th>
				<th width="100">艺术品名称</th>
				<th width="80">进价</th>
				<th width="80">起步价</th>
				<th width="80">一口价</th>
				<th width="80">竞价阶梯</th>
				<th width="120">开始时间</th>
                <th width="120">结束时间</th>            
				<th width="80">操作</th>
			</tr>
		</thead>
	<tbody>
		<c:forEach items="${auctionInfoList}" var="auctionInfoList" varStatus="status">
		<tr>
          <td><label><input type="checkbox" class="ace"><span class="lbl"></span></label></td>
          <td id="text_i">${auctionInfoList.auctionInfoId}</td>
          <td><u style="cursor:pointer" class="text-primary" onclick="layer_show('${auctionInfoList.art.artName}','${pageContext.request.contextPath}/Art/getArt?artId=${auctionInfoList.art.artId}&sign=1','500','400')">${auctionInfoList.art.artName}</u></td>
          <td>${auctionInfoList.art.artCost}</td>
          <td id="text_s">${auctionInfoList.auctionStartPrice}</td>
          <td id="text_o">${auctionInfoList.auctionOnePrice}</td>
          <td id="text_l">${auctionInfoList.auctionLadder}</td>
          <td id="text_st" class="text-l">${auctionInfoList.auctionStartTime}</td>
          <td id="text_et">${auctionInfoList.auctionEndTime}</td>
       <td class="td-manage">
        <a title="修改" onclick="member_edit('550',this)" href="javascript:;"  class="btn btn-xs btn-info" ><i class="fa fa-edit bigger-120"></i></a>      
        <a title="删除" href="javascript:;"  onclick="member_del(this,'1')" class="btn btn-xs btn-warning" ><i class="fa fa-trash  bigger-120"></i></a>
       </td>
      </tr>
      </c:forEach>
    </tbody>
    </table>
  </div>
 </div>
</div>
<!--修改图层-->
<div class="add_menber" id="add_menber_style" style="display:none">
  <form action="" method="post" id="form">
  <ul>
  <span class="name"><input type="hidden" id="text0" value="${AuctionInfo.auctionInfoId}" name="auctionInfoId"></span>
   <li><label class="label_name">起拍价：</label><span class="name"><input id="text1" value="${AuctionInfo.auctionStartPrice}" name="auctionStartPrice"></span></li>
   <li><label class="label_name">竞价阶梯：</label><span class="name"><input id="text2" value="${AuctionInfo.auctionLadder}" name="auctionLadder"></span></li>
   <li><label class="label_name">一口价：</label><span class="name"><input id="text3" type="text" value="${AuctionInfo.auctionOnePrice}" name="auctionOnePrice"></span></li>
   <li><label class="label_name">开始时间：</label><span class="name"><input id="d4311" class="Wdate" type="text"  onClick="WdatePicker({maxDate:'#F{$dp.$D(\'d4312\')||\'2020-10-01\'}',minDate:'%y-%M-{%d+1}',dateFmt:'yyyy-MM-dd 00:00:00'})" name="auctionStartTime" value="${AuctionInfo.auctionStartTime}"/></span></li>
   <li><label class="label_name">结束时间：</label><span class="name"><input  id="d4312" class="Wdate" type="text"  onClick="WdatePicker({minDate:'#F{$dp.$D(\'d4311\',{d:1})}',maxDate:'#F{$dp.$D(\'d4311\',{d:3})}',dateFmt:'yyyy-MM-dd 00:00:00'})" name="auctionEndTime"value="${AuctionInfo.auctionEndTime}"/></span></li>  
  </ul> 
  </form>
 </div>
</body>
</html>
<script type="text/javascript">
jQuery(function($) {
	var oTable1 = $('#sample-table').dataTable( {
	"aaSorting": [[ 1, "desc" ]],//默认第几个排序
"bStateSave": true,//状态保存
"aoColumnDefs": [
//{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
{"orderable":false,"aTargets":[0,2,9]}// 制定列不参与排序
] } );
	
	
	$('table th input:checkbox').on('click' , function(){
		var that = this;
		$(this).closest('table').find('tr > td:first-child input:checkbox')
		.each(function(){
			this.checked = that.checked;
			$(this).closest('tr').toggleClass('selected');
		});
			
	});


	$('[data-rel="tooltip"]').tooltip({placement: tooltip_placement});
	function tooltip_placement(context, source) {
		var $source = $(source);
		var $parent = $source.closest('table')
		var off1 = $parent.offset();
		var w1 = $parent.width();

		var off2 = $source.offset();
		var w2 = $source.width();

		if( parseInt(off2.left) < parseInt(off1.left) + parseInt(w1 / 2) ) return 'right';
		return 'left';
	}
})
/*用户-查看*/
function layer_show(title,url,w,h){
	if (title == null || title == '') {
		title=false;
	};
	if (url == null || url == '') {
		url="404.html";
	};
	if (w == null || w == '') {
		w=800;
	};
	if (h == null || h == '') {
		h=($(window).height() - 50);
	};
	layer.open({
		type: 2,
		area: [w+'px', h +'px'],
		fix: false, //不固定
		maxmin: true,
		shade:0.4,
		title: title,
		content: url
	});
}
/*关闭弹出框口*/
function layer_close(){
	var index = parent.layer.getFrameIndex(window.name);
	parent.layer.close(index);
}
/*拍卖信息-编辑*/
function member_edit(id,t){
	  $("#text0").val($(t).closest("tr").find("#text_i").text());
	  $("#text1").val($(t).closest("tr").find("#text_s").text());
	  $("#text2").val($(t).closest("tr").find("#text_l").text());
	  $("#text3").val($(t).closest("tr").find("#text_o").text());
	  $("#d4311").val($(t).closest("tr").find("#text_st").text());
	  $("#d4312").val($(t).closest("tr").find("#text_et").text());
	  layer.open({
        type: 1,
        title: '修改拍卖信息',
		maxmin: true, 
		shadeClose:false, //点击遮罩关闭层
        area : ['800px' , ''],
        content:$('#add_menber_style'),
		btn:['提交','取消'],
		yes:function(index,layero){	
		 var num=0;
		 var str="";
     $(".add_menber input[type$='text']").each(function(n){
          if($(this).val()=="")
          {
               
			   layer.alert(str+=""+$(this).attr("name")+"不能为空！\r\n",{
                title: '提示框',				
				icon:0,								
          }); 
		    num++;
            return false;            
          } 
		 });
		  if(num>0){  return false;}	 	
          else{
        	  $.ajax({
        	         type: "POST",
        	         url: "update",
        	         data: $('#form').serialize(),
        	         success: function (date) {
        	        	if(date=="success")
        	        		{
        	        	 layer.alert('添加成功！',{
        	                 title: '提示框',				
        	  			icon:1,		
        	  			  });
        	        	 
   			          $(t).closest("tr").find("#text_s").text($("#text1").val());
        	    	  $(t).closest("tr").find("#text_l").text($("#text2").val());
        	    	  $(t).closest("tr").find("#text_o").text($("#text3").val());
        	    	  $(t).closest("tr").find("#text_st").text($("#d4311").val());
        	    	  $(t).closest("tr").find("#text_et").text($("#d4312").val());
        	        		}	 
        	         }
        	     })

			   layer.close(index);
		  }		  		     				
		}
    });
	  
}
/*用户-删除*/
function member_del(obj,id){
	layer.confirm('确认要删除吗？',function(index){
		$(obj).parents("tr").remove();
		layer.msg('已删除!',{icon:1,time:1000});
	});
}
laydate({
    elem: '#start',
    event: 'focus' 
});

</script>